<template>
	<view class="main">
		<view
			class="avatar-box"
			:style="
				'width:' +
				width +
				'rpx' +
				';' +
				'height:' +
				width +
				'rpx' +
				';' +
				'line-height:' +
				width +
				'rpx'
			"
		>
			<text :style="'font-size:' + fontsize + 'rpx'">{{ name }}</text>
		</view>
		<image
			v-if="status"
			:src="statusIcon"
			class="avatar-icon"
			:style="'left:' + left + 'rpx;' + 'top:' + left + 'rpx'"
		></image>
	</view>
</template>

<script>
export default {
	props: {
		name: {
			type: String,
			value: '',
			default: '',
		},
		status: {
			type: String,
			value: '',
			default: '',
		},
		size: {
			type: Number,
			value: 30,
			default: 30,
		},
		width: {
			type: Number,
			value: 55,
			default: 55,
		},
		fontsize: {
			type: Number,
			value: 24,
			default: 24,
		},
		left: {
			type: Number,
			value: 55,
			default: 55,
		},
	},
	data() {
		return {}
	},
	computed: {
		statusIcon() {
			switch (this.status) {
				case 'error':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/b1u5noule1lwgvw70fve3ih6w.png'
				case 'pending':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/b3kzcjjbr4opwzeyt6xb7bra0.png'
				case 'success':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/1m8oflahwg4r6chwphvut2nfc.png'
				case 'audit':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/1m8oflahwg4r6chwphvut2nfc.png'
				case 'cc':
					return 'https://yilife-oss-online-public.oss-cn-hangzhou.aliyuncs.com/10000001/1015/ADMIN/p0xfkgg90gvyn1a4p0tadbnk0.png'
				case 'comment':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/ng68hz4qbluz2gve3u4e57jp2.png'
				case 'transfer':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/1m8oflahwg4r6chwphvut2nfc.png'
				case 'add':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/3yes5ekgdq65ceg0b57yt8smu.png'
				case 'cancel':
					return 'cancel'
				case 'recall':
					return 'https://yilife-oss-dev-public.oss-cn-hangzhou.aliyuncs.com/34/130595/ORG/unrg921kfkof9qyzm5cil6ill.png'
				case 'leader':
					return 'leader'
				default:
					return null
			}
		},
	},
}
</script>

<style scoped>
.main {
	position: relative;
	z-index: 1;
}
.avatar-box {
	background-color: #409eff;
	color: #ffffff;
	text-align: center;
	border-radius: 8rpx;
}
.avatar-icon {
	width: 35rpx;
	height: 35rpx;
	position: absolute;
	z-index: 10;
	background: #fff;
	border-radius: 50%;
}
.close-icon {
	position: absolute;
	top: 50%;
	left: 70%;
}
</style>
